package com.dd.cloud.common.constants;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author zk
 */
public class PresConstants {
    public static final List<String> DRUG_UNITS = Arrays.asList("ml ", "具 ", "枚 ", "片 ", "个 ", "对 ", "只 ", "粒 ", "条 ", "袋 ");

    /**
     * 处方状态
     */
    public interface PresStatus {
        // 正常 已生成订单
        int NOMER = 1;
        // 医生待审核
        int DOC_NO_REVIEW = 12;
        // 医生审核拒绝
        int DOC_REVIEW_REJECT = 13;
        // 医生审核超时
        int DOC_REVIEW_TIMEOUT = 14;
        // 正常 处方已发送到药房
        int SENDPHARM = 11;
        // 处方发送到药房失败
        int SENDPHARMERROR = 15;
        // 删除
        int DEL = -1;
        // 取消
        int CANCEL = 0;
        //审核 药房返回状态
        int AUDIT = 2;
        //审核失败 药房返回状态
        int AUDITNO = 21;
        //调剂 药房返回状态
        int ADJUST = 3;
        //复核 药房返回状态
        int REVIEW = 4;
        //泡药 药房返回状态
        int BMED = 5;
        //煎药 药房返回状态
        int TISANES = 6;
        //包装 药房返回状态
        int PACK = 7;
        //发货 药房返回状态
        int DELIVERY = 8;
        //已完成/物流完成
        int SUC = 9;
        //处方状态流转出现异常
        int ERROR = -2;
        //能删除处方的状态
        List<Integer> canDel = Arrays.asList(NOMER, CANCEL, SUC, DOC_REVIEW_REJECT);
        //能取消处方的状态
        List<Integer> canCancel = Arrays.asList(SENDPHARM, SENDPHARMERROR, AUDIT, ADJUST, NOMER);
        //一方制药查询状态
        String PRES_STATUS_ROAM_IN = "11,2,3,4,7,8";
        //华润查询状态
        String PRES_STATUS_HR_IN = "11,21,2,6,8,-2";
        //和顺堂查询状态
        String PRES_STATUS_HST_IN = "11,21,2,6,8";

        String PRES_STATUS_ALL="11,12,13,14,15,2,21,3,4,5,6,7,8,9,-2,0,1";
    }

    /**
     * 诊断结果状态
     */
    public interface ResultStatus {
        // 正常
        int NOMER = 1;
        // 删除
        int DEL = -1;
    }

    /**
     * 处方药品状态
     */
    public interface PresDrugsStatus {
        // 正常
        int NOMER = 1;
        // 删除
        int DEL = -1;
    }

    /**
     * 是否ai开方
     */
    public interface IsAIPres {
        // 是
        int YES = 1;
        // 否
        int NO = 0;
    }

    /**
     * 处方药品状态
     */
    public interface ModelDrugsStatus {
        // 正常
        int NOMER = 1;
        // 下架
        int DISABLE = 3;
        // 删除
        int DEL = -1;
    }

    /**
     * 处方药品状态
     */
    public interface DrugsPresStatus {
        // 正常
        int NOMER = 1;
        // 删除
        int DEL = -1;
    }

    /**
     * 药房回调数据状态
     */
    public interface RoamStatus {
        // 正常
        int NOMER = 1;
        // 删除
        int DEL = -1;
    }

    /**
     * 宏济堂药房通知的处方状态
     */
    public interface HjtPresStatus {
        String AUDIT = "审核";

        String ADJUST = "调剂";

        String REVIEW = "复核";

        String BMED = "泡药";

        String TISANES = "煎药";

        String PACK = "包装";

        String DELIVERY = "发货";
    }

    /**
     * 大参林回调处方状态
     */
    public interface DslPresStatus {
        int AUDITSUC = 1;

        int ADJUSTNO = 2;
    }

    /**
     * 大参林回调物流类型
     */
    public interface DslPresType {
        int OUTBOUND = 1;

        int SIGNIN = 2;
    }

    /**
     * 康美回调处方状态
     */
    public interface KmPresStatus {
        int AUDITSUC = 1;

        int ADJUSTNO = 2;
    }

    /**
     * 康美回调物流类型
     */
    public interface KmPresType {
        int OUTBOUND = 1;

        int SIGNIN = 2;
    }

    public interface PresHistoryStatus {
        // 正常
        int NOMER = 1;
        // 删除
        int DEL = -1;
    }

    /**
     * 宏济堂加工剂型
     */
    public interface DrugsProcessingStatus {
        //1.汤剂  3.打粉 17.打粉100 -1.超微打粉 6.水丸 11.浓缩丸 8.水蜜丸 7.蜜丸 5.膏方 9.低温真空制粉
        int DECOCTION = 1;

        int BEATPOWDER = 3;

        int BEATPOWDER100 = 17;

        int MINBEATPOWDER = -1; //待定

        int WATERPILLS = 6;

        int LONGSUOPILLS = 11;

        int SECRETPILLS = 7;

        int WATERSECRETPILLS = 8;

        int ANOINTING = 5;

        int LOWPULVERIZATION = 9;
    }

    /**
     * 药房后台剂型定义
     */
    public interface DrugsProcessingType {
        //        类型
        //        1.饮片代煎
        //        2.饮片不代煎
        //        3.颗粒剂
        //        4.水丸
        //        5.浓缩丸
        //        6.水蜜丸
        //        7.蜜丸
        //        8.膏方 "
//                9.粉剂(40目及以下)
//                10.粉制(60目)
//                11.粉剂(80目)
//                12.粉剂(100目)
//                13.粉剂(150目)
//                14.粉剂(200目)
//                15.合煎制粉(200目)
//                16.粉剂(300目及以上)
        int ONE = 1;

        int TWO = 2;

        int THREE = 3;

        int FOUR = 4;

        int FIVE = 5;

        int SIX = 6;

        int SEVEN = 7;

        int EIGHT = 8;

        int NINE = 9;

        int TEN = 10;

        int ELEVEN = 11;

        int TWELVE = 12;

        int THIRTEEN = 13;

        int FOURTEEN = 14;

        int FIFTEEN = 15;

        int SIXTEEN = 16;

        List<Integer> oneRules = new ArrayList<>(Arrays.asList(ONE, TWO, THREE));

        List<String> oneRulesStr = new ArrayList<>(Arrays.asList("1", "2", "3"));

        List<Integer> twoRules = new ArrayList<>(Arrays.asList(FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, ELEVEN, TWELVE, THIRTEEN, FOURTEEN, FIFTEEN, SIXTEEN));

        List<String> twoRulesStr = new ArrayList<>(Arrays.asList("4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"));
    }

    /**
     * 辅料设置状态
     */
    public interface AuxiliaryMaterialStatus {
        // 正常
        int NOMER = 1;
        // 删除
        int DEL = -1;
        //禁用
        int FORBIDDEN = 2;

        List<Integer> status = Arrays.asList(NOMER, FORBIDDEN);
    }

    /**
     * 状态数字转换状态文字
     *
     * @param orderStatus
     * @param presStatus
     * @return
     */
    public static String statusToStatusText(Integer orderStatus, Integer presStatus) {
        switch (orderStatus) {
            case OrderConstants.Status.NOPAY:
                return "待付款";
            case OrderConstants.Status.PAY:
                switch (presStatus) {
                    case PresStatus.SENDPHARM:
                        return "审核中";
                    case PresStatus.DOC_NO_REVIEW:
                        return "医生审核中";
                    case PresStatus.DOC_REVIEW_REJECT:
                        return "医生审核拒绝";
                    case PresStatus.DOC_REVIEW_TIMEOUT:
                        return "医生审核超时";
                    case PresStatus.SENDPHARMERROR:
                        return "发送药房失败";
                    case PresStatus.AUDIT:
                        return "调剂中";
                    case PresStatus.AUDITNO:
                        return "审核失败";
                    case PresStatus.ADJUST:
                        return "复核中";
                    case PresStatus.REVIEW:
                        return "泡药中";
                    case PresStatus.BMED:
                        return "煎药中";
                    case PresStatus.TISANES:
                        return "包装中";
                    case PresStatus.PACK:
                        return "发货中";
                    case PresStatus.DELIVERY:
                        return "已发货";
                    case PresStatus.SUC:
                        return "已收货";
                    case PresStatus.ERROR:
                        return "流转异常";
                    default:
                        return "未知状态";
                }
            case OrderConstants.Status.TIMEOUT:
                return "超时订单";
            case OrderConstants.Status.CANCEL:
                return "已取消";
            case OrderConstants.Status.REFUND:
                return "退款中";
            case OrderConstants.Status.FULLREFUND:
                return "已退款";
            case OrderConstants.Status.DEL:
                return "已删除订单";
            case OrderConstants.Status.PARTREFUND:
                return "部分退款";
            default:
                return "未知状态";
        }
    }
}
